import 'package:inmotion_pro/pages/models/base_model.dart';

// 通用模型
class CommonModel extends BaseModel {
  String id;
  String title;
  String subTitle;
  String value;
  String subValue;
  String unit;
  String imgPath;
  bool isSelected;
  bool isEditable;

  CommonModel({
    this.id = "",
    this.title = "",
    this.subTitle = "",
    this.value = "",
    this.subValue = "",
    this.imgPath = "",
    this.unit = "",
    this.isEditable = false,
    this.isSelected = false,
  });

  // copyWith方法
  CommonModel copyWith({
    String? id,
    String? title,
    String? subTitle,
    String? value,
    String? subValue,
    String? imgPath,
    String? unit,
    bool? isEditable,
    bool? isSelected,
  }) {
    return CommonModel(
      id: id ?? this.id,
      title: title ?? this.title,
      subTitle: subTitle ?? this.subTitle,
      value: value ?? this.value,
      subValue: subValue ?? this.subValue,
      imgPath: imgPath ?? this.imgPath,
      unit: unit ?? this.unit,
      isEditable: isEditable ?? this.isEditable,
      isSelected: isSelected ?? this.isSelected,
    );
  }

  @override
  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'title': title,
      'subTitle': subTitle,
      'value': value,
      'subValue': subValue,
      'imgPath': imgPath,
      'unit': unit,
      'isEditable': isEditable,
      'isSelected': isSelected,
    };
  }
}
